﻿using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;

namespace Bpmn.Xml;

/// <remarks/>
[XmlInclude(typeof(Task))]
[XmlInclude(typeof(UserTask))]
[XmlInclude(typeof(ServiceTask))]
[XmlInclude(typeof(SendTask))]
[XmlInclude(typeof(ScriptTask))]
[XmlInclude(typeof(ReceiveTask))]
[XmlInclude(typeof(ManualTask))]
[XmlInclude(typeof(BusinessRuleTask))]
[XmlInclude(typeof(SubProcess))]
[XmlInclude(typeof(Transaction))]
[XmlInclude(typeof(AdHocSubProcess))]
[XmlInclude(typeof(CallActivity))]
[Serializable]
[XmlType(Namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL", TypeName = "tActivity")]
[XmlRoot("activity", Namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL", IsNullable = false)]
public abstract partial class Activity : FlowNode
{
    /// <remarks/>
    [XmlElement("ioSpecification")]
    public InputOutputSpecification IoSpecification { get; set; } = default!;

    /// <remarks/>
    [XmlElement("property")]
    public Property[] Property { get; set; } = default!;

    /// <remarks/>
    [XmlElement("dataInputAssociation")]
    public DataInputAssociation[] DataInputAssociation { get; set; } = default!;

    /// <remarks/>
    [XmlElement("dataOutputAssociation")]
    public DataOutputAssociation[] DataOutputAssociation { get; set; } = default!;

    /// <remarks/>
    [XmlElement("performer", typeof(Performer))]
    [XmlElement("resourceRole", typeof(ResourceRole))]
    public ResourceRole[] Items { get; set; } = default!;

    /// <remarks/>
    [XmlElement("loopCharacteristics", typeof(LoopCharacteristics))]
    [XmlElement("multiInstanceLoopCharacteristics", typeof(MultiInstanceLoopCharacteristics))]
    [XmlElement("standardLoopCharacteristics", typeof(StandardLoopCharacteristics))]
    public LoopCharacteristics Item { get; set; } = default!;

    /// <remarks/>
    [XmlAttribute("isForCompensation")]
    [DefaultValue(false)]
    public bool IsForCompensation { get; set; } = false;


    /// <remarks/>
    [XmlAttribute("startQuantity", DataType = "integer")]
    [DefaultValue("1")]
    public string StartQuantity { get; set; } = "1";


    /// <remarks/>
    [XmlAttribute("completionQuantity", DataType = "integer")]
    [DefaultValue("1")]
    public string CompletionQuantity { get; set; } = "1";


    /// <remarks/>
    [XmlAttribute("default", DataType = "IDREF")]
    public string Default { get; set; } = default!;
}
